package kdtree;

import java.util.Random;

public class GenerateDataUtil {

	public static double[][] generate(int total,int onesize) {
		double[][] result=new double[total][onesize];
		for(int i=0;i<total;i++){
			result[i]=generate(onesize);
		}
		return result;
	}

	static Random random=new Random(System.nanoTime());
	
	public static double[] generate(int onesize) {
		double[] result=new double[onesize];	
		for(int i=0;i<onesize;i++){
			result[i]=random.nextDouble();
		}
		return result;
	}
	public static double pointDist(double[] p1, double[] p2) {
        double d = 0;

        for (int i = 0; i < p1.length; i++) {
            double diff = (p1[i] - p2[i]);
            if (!Double.isNaN(diff)) {
                d += diff * diff;
            }
        }

        return d;
    }

}
